<!DOCTYPE html>
<html lang="zh">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      canvas {
        border: 1px solid red;
      }
    </style>
  </head>
  <body>
    <canvas id="canvas" width="300" height="300"></canvas>

    <script>
      let canvas = document.querySelector("#canvas");
      let context = canvas.getContext("2d");

      // context.arc(150, 150, 50, 0, 2 * Math.PI);
      // context.stroke();

      // 随机颜色
      // red #ff0000 rgb(255,0,0) hsl(90,100, 50%)

      for (let i = 0; i < 15; i++) {
        context.beginPath();

        context.arc(150, 150, i * 10, 0, 2 * Math.PI);
        context.strokeStyle = "#" + Math.random().toString(16).slice(-6);
        context.stroke();
        context.closePath();
      }
    </script>
  </body>
</html>
